<?php

if (!defined('PDNS_INSTALLER')) {
	exit('Use index.php to install.');
}

$queries[] = "DROP TABLE IF EXISTS domains";
$queries[] = "CREATE TABLE domains (
  id INTEGER PRIMARY KEY,
  name varchar(255) NOT NULL DEFAULT '',
  master varchar(128) DEFAULT NULL,
  last_check int(11) DEFAULT NULL,
  type varchar(6) NOT NULL DEFAULT '',
  notified_serial int(11) DEFAULT NULL,
  account varchar(40) DEFAULT NULL
)";

$queries[] = "CREATE UNIQUE INDEX name_index ON domains(name)";

$queries[] = "DROP TABLE IF EXISTS records";
$queries[] = "CREATE TABLE records (
  id INTEGER PRIMARY KEY,
  domain_id int(11) DEFAULT NULL,
  name varchar(255) DEFAULT NULL,
  type varchar(6) DEFAULT NULL,
  content varchar(255) DEFAULT NULL,
  ttl int(11) DEFAULT NULL,
  prio int(11) DEFAULT NULL,
  change_date int(11) DEFAULT NULL
)";

$queries[] = "CREATE INDEX rec_name_index ON records(name)";
$queries[] = "CREATE INDEX nametype_index ON records(name,type)";
$queries[] = "CREATE INDEX domain_id ON records(domain_id)";

$queries[] = "DROP TABLE IF EXISTS supermasters";
$queries[] = "CREATE TABLE supermasters (
  ip varchar(25) NOT NULL,
  nameserver varchar(255) NOT NULL,
  account varchar(40) DEFAULT NULL
)";
?>
